﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SearchNode3.aspx.cs" Inherits="Workflow.Project.SearchNode3" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="../Css/style.css" />
    <link type="text/css" rel="stylesheet" href="../Css/pagination.css" />
    <script type="text/javascript" src="../Js/jquery.js"></script>
    <script type="text/javascript" src="../Js/jquery.sorted.js"></script>
    <script type="text/javascript" src="../Js/bootstrap.js"></script>
    <script type="text/javascript" src="../Js/ckform.js"></script>
    <script type="text/javascript" src="../Js/common.js"></script>

    <script type="text/javascript" src="../Scripts/MyJquery.js"></script>
    <script type="text/javascript" src="../Scripts/jquery.js"></script>
    <script type="text/javascript" src="../Scripts/jquery.pagination.js"></script>
    <script type="text/javascript" src="../Scripts/Pageination.js"></script>
    <style type="text/css">
        body {
            padding-bottom: 40px;
        }

        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


        .auto-style1 {
            width: 230px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <div style="margin:40px;">
            <asp:DropDownList ID="ddlSelect" runat="server"  AutoPostBack="True" OnSelectedIndexChanged="ddlSelect_SelectedIndexChanged">
                <asp:ListItem Value="1">阶段查询</asp:ListItem>
                <asp:ListItem Value="2">节点查询</asp:ListItem>
                <asp:ListItem Value="3" Selected="True">节点完成率查询</asp:ListItem>
                <asp:ListItem Value="4">样品前置审批查询</asp:ListItem>
                <asp:ListItem Value="5">样品发货查询</asp:ListItem>
                <asp:ListItem Value="6">项目执行进度查询</asp:ListItem>
                <asp:ListItem Value="7">活动查询</asp:ListItem>
            </asp:DropDownList>
        </div>
        <div>
            <table class="table table-bordered table-hover definewidth m10">

                <tr>
                    <td class="tableleft">模具号</td>
                    <td class="auto-style1">
                        <asp:TextBox ID="txtNo1" runat="server"></asp:TextBox></td>
                    <td>
                        <%--<asp:TextBox ID="txtNo2" runat="server"></asp:TextBox>--%></td>
                </tr>
                <tr>
                    <td class="tableleft">项目创建人</td>
                    <td class="auto-style1">
                        <asp:TextBox ID="txtPJCreater" runat="server"></asp:TextBox></td>
                    <td></td>
                </tr>
                <tr>
                    <td class="tableleft">节点预估完成时间</td>
                    <td class="auto-style1">
                        <asp:TextBox ID="txtCompleteDate1" type="date" runat="server" Width="174px"></asp:TextBox></td>
                    <td><asp:TextBox ID="txtCompleteDate2" type="date" runat="server" Width="174px"></asp:TextBox></td>
                </tr>
                <tr>
                    <td class="tableleft"></td>
                    <td class="auto-style1">
                        <asp:Button ID="BtnSubmit" CssClass="btn btn-primary" runat="server" Text="查询" OnClientClick="return Validate()" OnClick="BtnSubmit_Click" />
                    </td>
                    <td></td>
                </tr>
            </table>
            <% if(resultList.Count>0){ %>
            <table class="table table-bordered definewidth m10">
                <tr class="result">
                    <td>FOT完成率</td>
                    <td><%=fot %></td>
                    <td>OTS完成率</td>
                    <td><%=ots %></td>
                    <td>PPAP完成率</td>
                    <td><%=ppap %></td>
                </tr>
            </table>
            
            <table class="table table-bordered definewidth m10">
                <thead>
                    
                        <tr>
                            <th>模具号</th>
                            <th>创建人</th>
                            <th>节点名</th>
                            <th>节点预估完成时间</th>
                            <th>节点实际完成时间</th>
                        </tr>
                    
                </thead>
                <tbody id="Searchresult"></tbody>
                <tbody id="hiddenresult" style="display: none">
                    <% for (int i = 0; i < resultList.Count; i++)
                       { %>
                    <tr class="result">
                        <td><a href="#" onclick="SearchLog('SearchMain1.aspx','<%= resultList[i].PJId %>')"><% =resultList[i].PJId %></a></td>
                        <td><% =resultList[i].DisplayName %></td>
                        <td><% =resultList[i].NodeName %></td>
                        <td id="t1end<%=i %>">
                            <label id="end<%=i %>" class="date"><%=resultList[i].CompleteDate.ToShortDateString()%></label>
                        </td>
                        <td id="t1realend<%=i %>">
                            <label id="realend<%=i %>" class="date"><%=resultList[i].RealCompleteDate.ToShortDateString()%></label>
                        </td>
                    </tr>
                    <% }%>
                </tbody>
            </table>
            <%}%>
            <div id="Pagination" class="pagination definewidth m10"></div>
        </div>
    </form>
    <script type="text/javascript">
        $(document).ready(function () {
            var count = "<% =resultList.Count%>";
            if (count >= 10) {
                $("#Pagination").show();
            } else {
                $("#Pagination").hide();
            }
            $(".date").each(function () {
                if ($(this).text() == "1900/01/01" || $(this).text() == "1900/1/1") {
                    $(this).text("");
                }
            });
            List();
            $("a").click(function () {
                List();
            });


        });
        function List() {
            var count = "<% =resultList.Count%>";
            for (var i = 0; i < count; i++) {
                ShowColor("#end", "#realend", "#t1realend", i);

            }
        }
        function ShowColor(str1, str2, str3, i) {
            var date1 = new Date($(str1 + i).text());
            var date2 = new Date($(str2 + i).text());
            var today = Date.now();
            if (date1 >= date2) {
                $(str3 + i).attr("class", "greenColor");
            }
            else if (date1 < date2) {
                $(str3 + i).attr("class", "yellowColor");
            }
            else if ($(str2 + i).text() == "" && date1 < today) {
                $(str3 + i).attr("class", "redColor");
            }
            else {

            }
        }
        function Validate() {
            if ($("#txtCompleteDate1").val().length == 0) {
                alert('请输入起始时间');
                return false;
            }
            if ($("#txtCompleteDate2").val().length == 0) {
                alert('请输入截止时间');
                return false;
            }
        }

    </script>
</body>
</html>
